<?php
    class Setting_Model extends CI_Model
    {
        var $table = "db_setting";
        function __construct()
        {
            parent::__construct();
        }
        function add_setting($data)
        {
            
            $data = array(
            'title_tv' => $data['title_tv'],
            'title_ta' => $data['title_ta'],
            'address_ta'   => $data['address_ta'],
            'address_tv'   => $data['address_tv'],
            'email_company' => $data['email_company'],
            'phone'     => $data['phone'],
            'fax'       => $data['fax'],
            'website'   => $data['website'],
            'hotline'   => $data['hotline'],
            'email_receive'     => $data['email_receive'],
            'google_code' => $data['google_code'],
            'capcha'      => $data['capcha'],
            'logo'        => $data['logo'],
            'logo_alt'    => $data['logo_alt'],
            'language'    => $data['language'],
            'style_email' => $data['style_email'],
            'smtp_host'   => $data['smtp_host'],
            'smtp_user'   => $data['smtp_user'],
            'smtp_pass'   => $data['smtp_pass'],
            'smtp_port'   => $data['smtp_port']        
            );
            $this->db->set($data);
            if($this->db->insert($this->table)) return true; else return false;
            
        }   
        function update_setting($id,$data)
        {
            $this->db->where('id_s',$id);
            $data = array(
            'title_tv' => $data['title_tv'],
            'title_ta' => $data['title_ta'],
            'address_ta'   => $data['address_ta'],
            'address_tv'   => $data['address_tv'],
            'email_company' => $data['email_company'],
            'phone'     => $data['phone'],
            'fax'       => $data['fax'],
            'website'   => $data['website'],
            'hotline'   => $data['hotline'],
            'email_receive'     => $data['email_receive'],
            'google_code' => $data['google_code'],
            'capcha'      => $data['capcha'],
            'logo'        => $data['logo'],
            'logo_alt'    => $data['logo_alt'],
            'language'    => $data['language'],
            'style_email' => $data['style_email'],
            'smtp_host'   => $data['smtp_host'],
            'smtp_user'   => $data['smtp_user'],
            'smtp_pass'   => $data['smtp_pass'],
            'smtp_port'   => $data['smtp_port']        
            );
            $this->db->set($data);
            if($this->db->update($this->table)) return true; else return false;           
                   
        }     
        function get_setting($id)
        {
          $this->db->where('id_s',$id);
          return $this->db->get($this->table)->row();  
        }
        
    }
?>